package com.example.intenttrial.bezier;

import java.util.List;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

public class DrawerView extends View {

	private Canvas canvas;
	private Paint paint;
	private List<Point> points;
	
	public DrawerView(Context context) {
		super(context);
	}
	
	public DrawerView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public DrawerView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		this.canvas = canvas;
		if(paint == null) {
			paint = new Paint();
		}
		paint.setColor(Color.BLACK);
		super.onDraw(canvas);
	}
	
	public void drawPoints(List<Point> points, List<Point> supportVertexies) {
		for(Point p : supportVertexies) {
			canvas.drawCircle(p.getX(), p.getY(), 7, paint);
		}
		for (Point p : points) {
			canvas.drawCircle(p.getX(), p.getY(), 3, paint);
		}
		invalidate();
	}

}
